home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 September (Special) / Chip-Special_2004-09_Digitalni-Hudba.bin / prehravace / apollo / Apollo37zf.exe / {app} / ApolloCommands.h < prev    next >
Text File  |  2003-10-21  |  11KB  |  303 lines

  1. /*
  2.   Updated 13.02.2003
  3.  
  4.   Here is a set of macros that can be used to interact with Apollo
  5.   from other programs.
  6.  
  7.   Available macros:
  8.  
  9.     Apollo_GetFirstApolloWindowHandle()
  10.     Apollo_GetNextApolloWindowHandle(hWnd)
  11.  
  12.     Apollo_GetVersion(hWnd)
  13.     Apollo_GetStatus(hWnd)
  14.         note: 0 = stopped, 1 = playing, 2 = paused
  15.  
  16.     Apollo_OpenFile(hWnd,filename)
  17.     Apollo_OpenDirectory(hWnd,dirname)
  18.     Apollo_OpenURL(hWnd,url)
  19.  
  20.     Apollo_AddFile(hWnd,filename)
  21.     Apollo_AddDirectory(hWnd,dirname)
  22.     Apollo_AddURL(hWnd,url)
  23.     Apollo_AddRandomEntry(hWnd,conditionExpression)
  24.  
  25.     Apollo_ClearPlaylist(hWnd)
  26.  
  27.     Apollo_PreviousTrack(hWnd)
  28.     Apollo_Stop(hWnd)
  29.     Apollo_Play(hWnd)
  30.     Apollo_Pause(hWnd)
  31.     Apollo_NextTrack(hWnd)
  32.     Apollo_FadeOut(hWnd)
  33.  
  34.     Apollo_PreviousTrackWithCrossfade(hWnd)
  35.     Apollo_PlayWithCrossfade(hWnd)
  36.     Apollo_NextTrackWithCrossfade(hWnd)
  37.  
  38.     Apollo_SetPlaylistPosition(hWnd,position)
  39.         note: position is the index in playlist, not the track number
  40.     Apollo_GetPlaylistPosition(hWnd)
  41.     Apollo_GetCurrentTrackNumber(hWnd)
  42.  
  43.     Apollo_SetPlaybackPosition(hWnd,position)
  44.     Apollo_GetPlaybackPosition(hWnd)
  45.     Apollo_GetPlaybackPlaylistPosition(hWnd)
  46.     Apollo_GetPlaybackCountdown(hWnd)
  47.     Apollo_GetPlaybackPlaylistCountDown(hWnd)
  48.  
  49.     Apollo_SetVolume(hWnd,volume)
  50.         note: volume is value between 0x0000 and 0xffff
  51.     Apollo_GetVolume(hWnd)
  52.  
  53.     Apollo_CreateSampleSpace(hWnd)
  54.         returns 0 if no tracks were found, otherwise 1
  55.     Apollo_SetSampleSpaceSearchPath(hWnd,searchPath)
  56.  
  57.     Apollo_GetCurrentlyPlayedFilename(hWnd,buffer,bufferSize)
  58.         copies full filename or URL to the buffer
  59.     Apollo_GetCurrentlyPlayedTitle(hWnd,buffer,bufferSize)
  60.  
  61.     Apollo_GetPlaylistEntry(hWnd,index,buffer,bufferSize)
  62.         copies full filename, URL or the condition expression
  63.         beginning with semicolon to the buffer
  64.     Apollo_GetPlaylistTitle(hWnd,index,buffer,bufferSize)
  65. */
  66.  
  67. // Window message definition
  68.  
  69. #define WM_APOLLO_COMMAND                       WM_USER + 3
  70.  
  71. // WM_APOLLO_COMMAND command definitions
  72.  
  73. #define APOLLO_GETVERSION                       0
  74. #define APOLLO_GETSTATUS                        1
  75.  
  76. #define APOLLO_OPENFILE                         2
  77. #define APOLLO_OPENDIRECTORY                    3
  78. #define APOLLO_OPENURL                          4
  79.  
  80. #define APOLLO_ADDFILE                          5
  81. #define APOLLO_ADDDIRECTORY                     6
  82. #define APOLLO_ADDURL                           7
  83. #define APOLLO_ADDRANDOMENTRY                   8
  84.  
  85. #define APOLLO_CLEARPLAYLIST                    9
  86.  
  87. #define APOLLO_PREVIOUSTRACK                    10
  88. #define APOLLO_STOP                             11
  89. #define APOLLO_PLAY                             12
  90. #define APOLLO_PAUSE                            13
  91. #define APOLLO_NEXTTRACK                        14
  92. #define APOLLO_FADEOUT                          31
  93.  
  94. #define APOLLO_PREVIOUSTRACKWITHCROSSFADE       29
  95. #define APOLLO_PLAYWITHCROSSFADE                30
  96. #define APOLLO_NEXTTRACKWITHCROSSFADE           28
  97.  
  98. #define APOLLO_SETPLAYLISTPOSITION              15
  99. #define APOLLO_GETPLAYLISTPOSITION              16
  100. #define APOLLO_GETCURRENTTRACKNUMBER            17
  101.  
  102. #define APOLLO_SETPLAYBACKPOSITION              18
  103. #define APOLLO_GETPLAYBACKPOSITION              19
  104. #define APOLLO_GETPLAYBACKPLAYLISTPOSITION      32
  105. #define APOLLO_GETPLAYBACKCOUNTDOWN             33
  106. #define APOLLO_GETPLAYBACKPLAYLISTCOUNTDOWN     34
  107.  
  108. #define APOLLO_SETVOLUME                        20
  109. #define APOLLO_GETVOLUME                        21
  110.  
  111. #define APOLLO_CREATESAMPLESPACE                22
  112. #define APOLLO_SETSAMPLESPACESEARCHPATH         23
  113.  
  114. #define APOLLO_GETCURRENTLYPLAYEDFILENAME       24
  115. #define APOLLO_GETCURRENTLYPLAYEDTITLE          25
  116.  
  117. #define APOLLO_GETPLAYLISTENTRY                 26
  118. #define APOLLO_GETPLAYLISTTITLE                 27
  119.  
  120. // Macro definitions
  121.  
  122. #define Apollo_GetFirstApolloWindowHandle() \
  123.     (HWND)FindWindow("Apollo - Main Window",NULL)
  124.  
  125. #define Apollo_GetNextApolloWindowHandle(hWnd) \
  126.     (HWND)FindWindowEx(NULL,hWnd,"Apollo - Main Window",NULL)
  127.  
  128.  
  129. #define Apollo_GetVersion(hWnd) \
  130.     (int)SendMessage(hWnd,WM_APOLLO_COMMAND,(WPARAM)MAKELONG(APOLLO_GETVERSION,0),(LPARAM)0)
  131.  
  132. #define Apollo_GetStatus(hWnd) \
  133.     (int)SendMessage(hWnd,WM_APOLLO_COMMAND,(WPARAM)MAKELONG(APOLLO_GETSTATUS,0),(LPARAM)0)
  134.  
  135.  
  136. #define Apollo_OpenFile(hWnd,filename) \
  137.     { \
  138.         COPYDATASTRUCT cds; \
  139.         cds.dwData = APOLLO_OPENFILE; \
  140.         cds.lpData = (void *)filename; \
  141.         cds.cbData = strlen((char *)cds.lpData) + 1; \
  142.         SendMessage(hWnd,WM_COPYDATA,(WPARAM)NULL,(LPARAM)&cds); \
  143.     }
  144.  
  145. #define Apollo_OpenDirectory(hWnd,dirname) \
  146.     { \
  147.         COPYDATASTRUCT cds; \
  148.         cds.dwData = APOLLO_OPENDIRECTORY; \
  149.         cds.lpData = (void *)dirname; \
  150.         cds.cbData = strlen((char *)cds.lpData) + 1; \
  151.         SendMessage(hWnd,WM_COPYDATA,(WPARAM)NULL,(LPARAM)&cds); \
  152.     }
  153.  
  154. #define Apollo_OpenURL(hWnd,url) \
  155.     { \
  156.         COPYDATASTRUCT cds; \
  157.         cds.dwData = APOLLO_OPENURL; \
  158.         cds.lpData = (void *)url; \
  159.         cds.cbData = strlen((char *)cds.lpData) + 1; \
  160.         SendMessage(hWnd,WM_COPYDATA,(WPARAM)NULL,(LPARAM)&cds); \
  161.     }
  162.  
  163.  
  164. #define Apollo_AddFile(hWnd,filename) \
  165.     { \
  166.         COPYDATASTRUCT cds; \
  167.         cds.dwData = APOLLO_ADDFILE; \
  168.         cds.lpData = (void *)filename; \
  169.         cds.cbData = strlen((char *)cds.lpData) + 1; \
  170.         SendMessage(hWnd,WM_COPYDATA,(WPARAM)NULL,(LPARAM)&cds); \
  171.     }
  172.  
  173. #define Apollo_AddDirectory(hWnd,dirname) \
  174.     { \
  175.         COPYDATASTRUCT cds; \
  176.         cds.dwData = APOLLO_ADDDIRECTORY; \
  177.         cds.lpData = (void *)dirname; \
  178.         cds.cbData = strlen((char *)cds.lpData) + 1; \
  179.         SendMessage(hWnd,WM_COPYDATA,(WPARAM)NULL,(LPARAM)&cds); \
  180.     }
  181.  
  182. #define Apollo_AddURL(hWnd,url) \
  183.     { \
  184.         COPYDATASTRUCT cds; \
  185.         cds.dwData = APOLLO_ADDURL; \
  186.         cds.lpData = (void *)url; \
  187.         cds.cbData = strlen((char *)cds.lpData) + 1; \
  188.         SendMessage(hWnd,WM_COPYDATA,(WPARAM)NULL,(LPARAM)&cds); \
  189.     }
  190.  
  191. #define Apollo_AddRandomEntry(hWnd,conditionExpression) \
  192.     { \
  193.         COPYDATASTRUCT cds; \
  194.         cds.dwData = APOLLO_ADDRANDOMENTRY; \
  195.         cds.lpData = (void *)conditionExpression; \
  196.         cds.cbData = strlen((char *)cds.lpData) + 1; \
  197.         SendMessage(hWnd,WM_COPYDATA,(WPARAM)NULL,(LPARAM)&cds); \
  198.     }
  199.  
  200.  
  201. #define Apollo_ClearPlaylist(hWnd) \
  202.     SendMessage(hWnd,WM_APOLLO_COMMAND,(WPARAM)MAKELONG(APOLLO_CLEARPLAYLIST,0),(LPARAM)0)
  203.  
  204.  
  205. #define Apollo_PreviousTrack(hWnd) \
  206.     SendMessage(hWnd,WM_APOLLO_COMMAND,(WPARAM)MAKELONG(APOLLO_PREVIOUSTRACK,0),(LPARAM)0)
  207.  
  208. #define Apollo_Stop(hWnd) \
  209.     SendMessage(hWnd,WM_APOLLO_COMMAND,(WPARAM)MAKELONG(APOLLO_STOP,0),(LPARAM)0)
  210.  
  211. #define Apollo_Play(hWnd) \
  212.     SendMessage(hWnd,WM_APOLLO_COMMAND,(WPARAM)MAKELONG(APOLLO_PLAY,0),(LPARAM)0)
  213.  
  214. #define Apollo_Pause(hWnd) \
  215.     SendMessage(hWnd,WM_APOLLO_COMMAND,(WPARAM)MAKELONG(APOLLO_PAUSE,0),(LPARAM)0)
  216.  
  217. #define Apollo_NextTrack(hWnd) \
  218.     SendMessage(hWnd,WM_APOLLO_COMMAND,(WPARAM)MAKELONG(APOLLO_NEXTTRACK,0),(LPARAM)0)
  219.  
  220. #define Apollo_FadeOut(hWnd) \
  221.     SendMessage(hWnd,WM_APOLLO_COMMAND,(WPARAM)MAKELONG(APOLLO_FADEOUT,0),(LPARAM)0)
  222.  
  223.  
  224. #define Apollo_PreviousTrackWithCrossfade(hWnd) \
  225.     SendMessage(hWnd,WM_APOLLO_COMMAND,(WPARAM)MAKELONG(APOLLO_PREVIOUSTRACKWITHCROSSFADE,0),(LPARAM)0)
  226.  
  227. #define Apollo_PlayWithCrossfade(hWnd) \
  228.     SendMessage(hWnd,WM_APOLLO_COMMAND,(WPARAM)MAKELONG(APOLLO_PLAYWITHCROSSFADE,0),(LPARAM)0)
  229.  
  230. #define Apollo_NextTrackWithCrossfade(hWnd) \
  231.     SendMessage(hWnd,WM_APOLLO_COMMAND,(WPARAM)MAKELONG(APOLLO_NEXTTRACKWITHCROSSFADE,0),(LPARAM)0)
  232.  
  233.  
  234. #define Apollo_SetPlaylistPosition(hWnd,position) \
  235.     SendMessage(hWnd,WM_APOLLO_COMMAND,(WPARAM)MAKELONG(APOLLO_SETPLAYLISTPOSITION,0),(LPARAM)position)
  236.  
  237. #define Apollo_GetPlaylistPosition(hWnd) \
  238.     (int)SendMessage(hWnd,WM_APOLLO_COMMAND,(WPARAM)MAKELONG(APOLLO_GETPLAYLISTPOSITION,0),(LPARAM)0)
  239.  
  240. #define Apollo_GetCurrentTrackNumber(hWnd) \
  241.     (int)SendMessage(hWnd,WM_APOLLO_COMMAND,(WPARAM)MAKELONG(APOLLO_GETCURRENTTRACKNUMBER,0),(LPARAM)0)
  242.  
  243.  
  244. #define Apollo_SetPlaybackPosition(hWnd,position) \
  245.     SendMessage(hWnd,WM_APOLLO_COMMAND,(WPARAM)MAKELONG(APOLLO_SETPLAYBACKPOSITION,0),(LPARAM)position)
  246.  
  247. #define Apollo_GetPlaybackPosition(hWnd) \
  248.     (int)SendMessage(hWnd,WM_APOLLO_COMMAND,(WPARAM)MAKELONG(APOLLO_GETPLAYBACKPOSITION,0),(LPARAM)0)
  249.  
  250. #define Apollo_GetPlaybackPlaylistPosition(hWnd) \
  251.     (int)SendMessage(hWnd,WM_APOLLO_COMMAND,(WPARAM)MAKELONG(APOLLO_GETPLAYBACKPLAYLISTPOSITION,0),(LPARAM)0)
  252.  
  253. #define Apollo_GetPlaybackCountdown(hWnd) \
  254.     (int)SendMessage(hWnd,WM_APOLLO_COMMAND,(WPARAM)MAKELONG(APOLLO_GETPLAYBACKCOUNTDOWN,0),(LPARAM)0)
  255.  
  256. #define Apollo_GetPlaybackPlaylistCountDown(hWnd) \
  257.     (int)SendMessage(hWnd,WM_APOLLO_COMMAND,(WPARAM)MAKELONG(APOLLO_GETPLAYBACKPLAYLISTCOUNTDOWN,0),(LPARAM)0)
  258.  
  259.  
  260. #define Apollo_SetVolume(hWnd,volume) \
  261.     SendMessage(hWnd,WM_APOLLO_COMMAND,(WPARAM)MAKELONG(APOLLO_SETVOLUME,0),(LPARAM)volume)
  262.  
  263. #define Apollo_GetVolume(hWnd) \
  264.     (int)SendMessage(hWnd,WM_APOLLO_COMMAND,(WPARAM)MAKELONG(APOLLO_GETVOLUME,0),(LPARAM)0)
  265.  
  266.  
  267. #define Apollo_CreateSampleSpace(hWnd) \
  268.     (int)SendMessage(hWnd,WM_APOLLO_COMMAND,(WPARAM)MAKELONG(APOLLO_CREATESAMPLESPACE,0),(LPARAM)0)
  269.  
  270. #define Apollo_SetSampleSpaceSearchPath(hWnd,searchPath) \
  271.     { \
  272.         COPYDATASTRUCT cds; \
  273.         cds.dwData = APOLLO_SETSAMPLESPACESEARCHPATH; \
  274.         cds.lpData = (void *)searchPath; \
  275.         cds.cbData = strlen((char *)cds.lpData) + 1; \
  276.         SendMessage(hWnd,WM_COPYDATA,(WPARAM)NULL,(LPARAM)&cds); \
  277.     }
  278.  
  279.  
  280. #define Apollo_GetCurrentlyPlayedFilename(hWnd,buffer,bufferSize) \
  281.     { \
  282.         HWND hTempWnd = (HWND)SendMessage(hWnd,WM_APOLLO_COMMAND,(WPARAM)MAKELONG(APOLLO_GETCURRENTLYPLAYEDFILENAME,0),(LPARAM)0); \
  283.         SendMessage(hTempWnd,WM_GETTEXT,(WPARAM)bufferSize,(LPARAM)buffer); \
  284.     }
  285.  
  286. #define Apollo_GetCurrentlyPlayedTitle(hWnd,buffer,bufferSize) \
  287.     { \
  288.         HWND hTempWnd = (HWND)SendMessage(hWnd,WM_APOLLO_COMMAND,(WPARAM)MAKELONG(APOLLO_GETCURRENTLYPLAYEDTITLE,0),(LPARAM)0); \
  289.         SendMessage(hTempWnd,WM_GETTEXT,(WPARAM)bufferSize,(LPARAM)buffer); \
  290.     }
  291.  
  292. #define Apollo_GetPlaylistEntry(hWnd,index,buffer,bufferSize) \
  293.     { \
  294.         HWND hTempWnd = (HWND)SendMessage(hWnd,WM_APOLLO_COMMAND,(WPARAM)MAKELONG(APOLLO_GETPLAYLISTENTRY,0),(LPARAM)index); \
  295.         SendMessage(hTempWnd,WM_GETTEXT,(WPARAM)bufferSize,(LPARAM)buffer); \
  296.     }
  297.  
  298. #define Apollo_GetPlaylistTitle(hWnd,index,buffer,bufferSize) \
  299.     { \
  300.         HWND hTempWnd = (HWND)SendMessage(hWnd,WM_APOLLO_COMMAND,(WPARAM)MAKELONG(APOLLO_GETPLAYLISTTITLE,0),(LPARAM)index); \
  301.         SendMessage(hTempWnd,WM_GETTEXT,(WPARAM)bufferSize,(LPARAM)buffer); \
  302.     }
  303.